#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2014-08-22 01:14:23
# @Author  : shitao.tommy (hero007asd@gmail.com)
# @Link    : http://example.org
# @Version : $Id$

from web.handler.api import BaseApiHandler
from lib.tornado_routes import route
from tornado import gen
from tornado.web import asynchronous
from lib import libimage,libpage



head_title = '分类测试'

@route(r'api/dorm/auth/new/?',name='auth_new')
class NewAuthHandler(BaseApiHandler):
    '''
    @title 新增保洁职工
    @method post
    @param empName 姓名 12位最长
    @param age 年龄 
    @param dormId 宿管楼id 
    @param img 图片路径 
    @param entryTime 入职时间 
    @retfield isOk 增加成功与否1成功0失败 
    @return {status:200, message:'', data:null}---status:500(系统错误)400(请传入职工名)
    @description 新增保洁职工
    '''
    @asynchronous
    @gen.coroutine
    def get(self):
        emp_name = self.get_argument('empName', default='')
        version = self.get_argument('v', default=0)
        if version == 0:
            print dir(self)
        else:
            method = 'v' + version.replace('.', '_')
            if hasattr(self, method):
                mtd = getattr(self,method)
                a = yield mtd()
                print a
            else: print '400'

        # yield self.v1_0()

    @gen.coroutine
    def v1_0(self):
        print 'abc'
        raise gen.Return('asd')
